/*
 *  Range.h
 *  NSE_SOLVER
 *
 *  Created by Patrick Zulian on 1/16/11.
 *  Copyright 2011 ICS - USI - Lugano. All rights reserved.
 *
 */

#ifndef NSE_SOLVER_RANGE_H
#define NSE_SOLVER_RANGE_H
#include <iostream>

namespace nsesolver {
	
class Range {
private:
	 const int from, to, extent;
public:	
	Range(const int from, const int to)
	: from(from), to(to), extent(to - from)
	{}
	
	
	Range(const int fromAndTo)
	: from(fromAndTo), to(fromAndTo+1), extent(1)
	{}
	
	inline int getFrom() const
	{
		return from;
	}
	
	inline int getTo() const
	{
		return to;
	}
	
	inline int getExtent() const
	{
		return extent;
	}
	
	friend
	std::ostream & operator <<(std::ostream &os, const Range &range)
	{
		os << range.getFrom() << "\t";
		os << range.getTo() << "\t";
		os << std::endl;
		return os;
	}
	
};

}

#endif
